package com.ityangxu.langchain4j.tools;

import dev.langchain4j.agent.tool.P;
import dev.langchain4j.agent.tool.Tool;
import dev.langchain4j.agent.tool.ToolMemoryId;
import org.springframework.stereotype.Component;
@Component
public class CalculatorTools {
        @Tool(name = "add",value = "可以进行加法计算")
        //required = false 表示这个参数可输入可不输入
        double sum(@P(value = "第一个参数",required = false)double a,
                   double b,
                   @ToolMemoryId int memoryId) {
            System.out.println("调用加法运算+memoryId" + memoryId);
            return a + b;
        }
        @Tool
        double squareRoot(double x) {
            System.out.println("调用平方根运算");
            return Math.sqrt(x);
        }
    }
